﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="dsManutencaoPrecoCusto" targetNamespace="http://tempuri.org/dsManutencaoPrecoCusto.xsd" xmlns:mstns="http://tempuri.org/dsManutencaoPrecoCusto.xsd" xmlns="http://tempuri.org/dsManutencaoPrecoCusto.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="MySettings" AppSettingsPropertyName="SamecaGestConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="SamecaGestConnectionString (MySettings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.SamecaGestV2.My.MySettings.GlobalReference.Default.SamecaGestConnectionString1" Provider="System.Data.SqlClient" />
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ItemUnTableAdapter" GeneratorDataComponentClassName="ItemUnTableAdapter" Name="ItemUn" UserDataComponentName="ItemUnTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="SamecaGestConnectionString (MySettings)" DbObjectType="Unknown" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT        tblItem.No_, tblItem.[Extended Description], tblDefaultDimension.[Table ID], tblDefaultDimension.[Dimension Code], 
                         tblDefaultDimension.[Dimension Value Code], tblPrecoCustoOrcamento.PCtReal, tblPrecoCustoOrcamento.PCtSugerido, tblDefaultDimension.Company, 
                         tblPrecoCustoOrcamento.Ano, orcamento.[QD-ORC], orcamento.[PVD-ORC], orcamento.[Min-.PVD-ORC], orcamento.[Max-.PVD-ORC]
FROM            (SELECT        ANO, CODPROD, SUM([QD-ORC]) AS [QD-ORC], AVG([PVD-ORC]) AS [PVD-ORC], MAX([PVD-ORC]) AS [Min-.PVD-ORC], MIN([PVD-ORC]) 
                                                    AS [Max-.PVD-ORC]
                          FROM            tblOrcamento
                          WHERE        ([PVD-ORC] &lt;&gt; 0)
                          GROUP BY ANO, CODPROD) AS orcamento INNER JOIN
                         tblPrecoCustoOrcamento ON orcamento.ANO = tblPrecoCustoOrcamento.Ano AND 
                         orcamento.CODPROD = tblPrecoCustoOrcamento.CodProd RIGHT OUTER JOIN
                         tblDefaultDimension INNER JOIN
                         tblItem ON tblDefaultDimension.No_ = tblItem.No_ AND tblDefaultDimension.Company = tblItem.Company ON 
                         tblPrecoCustoOrcamento.CodProd = tblItem.No_ AND tblPrecoCustoOrcamento.Company = tblItem.Company
WHERE        (tblDefaultDimension.[Dimension Code] = 'UNEGOCIOP') AND (tblDefaultDimension.[Table ID] = 27) AND 
                         (tblDefaultDimension.[Dimension Value Code] LIKE @UN) AND (tblPrecoCustoOrcamento.Ano = @ano) AND (tblItem.Company = @company)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="UN" ColumnName="Dimension Value Code" DataSourceName="SAMECAGEST.dbo.tblDefaultDimension" DataTypeServer="varchar(20)" DbType="AnsiString" Direction="Input" ParameterName="@UN" Precision="0" ProviderType="VarChar" Scale="0" Size="20" SourceColumn="Dimension Value Code" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="ano" ColumnName="Ano" DataSourceName="SAMECAGEST.dbo.tblPrecoCustoOrcamento" DataTypeServer="varchar(4)" DbType="AnsiString" Direction="Input" ParameterName="@ano" Precision="0" ProviderType="VarChar" Scale="0" Size="4" SourceColumn="Ano" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="company" ColumnName="Company" DataSourceName="SAMECAGEST.dbo.tblItem" DataTypeServer="varchar(50)" DbType="AnsiString" Direction="Input" ParameterName="@company" Precision="0" ProviderType="VarChar" Scale="0" Size="50" SourceColumn="Company" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="Table ID" DataSetColumn="Table ID" />
              <Mapping SourceColumn="Dimension Code" DataSetColumn="Dimension Code" />
              <Mapping SourceColumn="Dimension Value Code" DataSetColumn="Dimension Value Code" />
              <Mapping SourceColumn="PCtReal" DataSetColumn="PCtReal" />
              <Mapping SourceColumn="Company" DataSetColumn="Company" />
              <Mapping SourceColumn="Extended Description" DataSetColumn="Extended Description" />
              <Mapping SourceColumn="No_" DataSetColumn="No_" />
              <Mapping SourceColumn="Ano" DataSetColumn="Ano" />
              <Mapping SourceColumn="PCtSugerido" DataSetColumn="PCtSugerido" />
              <Mapping SourceColumn="QD-ORC" DataSetColumn="QD-ORC" />
              <Mapping SourceColumn="PVD-ORC" DataSetColumn="PVD-ORC" />
              <Mapping SourceColumn="Min-.PVD-ORC" DataSetColumn="Min-_PVD-ORC" />
              <Mapping SourceColumn="Max-.PVD-ORC" DataSetColumn="Max-_PVD-ORC" />
            </Mappings>
            <Sources>
              <DbSource ConnectionRef="SamecaGestConnectionString (MySettings)" DbObjectName="" DbObjectType="Unknown" GenerateShortCommands="true" GeneratorSourceName="UpdateQueryPCtSugerido" Modifier="Public" Name="UpdateQueryPCtSugerido" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy" UserSourceName="UpdateQueryPCtSugerido">
                <UpdateCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>UPDATE       tblPrecoCustoOrcamento
SET                PCtSugerido = @PCtSugerido
WHERE        (Ano = @ano) AND (CodProd = @codprod) AND (Company = @company)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="true" AutogeneratedName="PCtSugerido" ColumnName="PCtSugerido" DataSourceName="SamecaGest.dbo.tblPrecoCustoOrcamento" DataTypeServer="decimal(18, 3)" DbType="Decimal" Direction="Input" ParameterName="@PCtSugerido" Precision="18" ProviderType="Decimal" Scale="3" Size="9" SourceColumn="PCtSugerido" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="true" AutogeneratedName="ano" ColumnName="Ano" DataSourceName="SamecaGest.dbo.tblPrecoCustoOrcamento" DataTypeServer="varchar(4)" DbType="AnsiString" Direction="Input" ParameterName="@ano" Precision="0" ProviderType="VarChar" Scale="0" Size="4" SourceColumn="Ano" SourceColumnNullMapping="false" SourceVersion="Original" />
                      <Parameter AllowDbNull="true" AutogeneratedName="codprod" ColumnName="CodProd" DataSourceName="SamecaGest.dbo.tblPrecoCustoOrcamento" DataTypeServer="varchar(50)" DbType="AnsiString" Direction="Input" ParameterName="@codprod" Precision="0" ProviderType="VarChar" Scale="0" Size="50" SourceColumn="CodProd" SourceColumnNullMapping="false" SourceVersion="Original" />
                      <Parameter AllowDbNull="false" AutogeneratedName="company" ColumnName="Company" DataSourceName="SamecaGest.dbo.tblPrecoCustoOrcamento" DataTypeServer="varchar(50)" DbType="AnsiString" Direction="Input" ParameterName="@company" Precision="0" ProviderType="VarChar" Scale="0" Size="50" SourceColumn="Company" SourceColumnNullMapping="false" SourceVersion="Original" />
                    </Parameters>
                  </DbCommand>
                </UpdateCommand>
              </DbSource>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="dsManutencaoPrecoCusto" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="dsManutencaoPrecoCusto" msprop:Generator_UserDSName="dsManutencaoPrecoCusto">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="ItemUn" msprop:Generator_TableClassName="ItemUnDataTable" msprop:Generator_TableVarName="tableItemUn" msprop:Generator_TablePropName="ItemUn" msprop:Generator_RowDeletingName="ItemUnRowDeleting" msprop:Generator_RowChangingName="ItemUnRowChanging" msprop:Generator_RowEvHandlerName="ItemUnRowChangeEventHandler" msprop:Generator_RowDeletedName="ItemUnRowDeleted" msprop:Generator_UserTableName="ItemUn" msprop:Generator_RowChangedName="ItemUnRowChanged" msprop:Generator_RowEvArgName="ItemUnRowChangeEvent" msprop:Generator_RowClassName="ItemUnRow">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Table_x0020_ID" msprop:Generator_ColumnVarNameInTable="columnTable_ID" msprop:Generator_ColumnPropNameInRow="Table_ID" msprop:Generator_ColumnPropNameInTable="Table_IDColumn" msprop:Generator_UserColumnName="Table ID" type="xs:int" />
              <xs:element name="Dimension_x0020_Code" msprop:Generator_ColumnVarNameInTable="columnDimension_Code" msprop:Generator_ColumnPropNameInRow="Dimension_Code" msprop:Generator_ColumnPropNameInTable="Dimension_CodeColumn" msprop:Generator_UserColumnName="Dimension Code">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Dimension_x0020_Value_x0020_Code" msprop:Generator_ColumnVarNameInTable="columnDimension_Value_Code" msprop:Generator_ColumnPropNameInRow="Dimension_Value_Code" msprop:Generator_ColumnPropNameInTable="Dimension_Value_CodeColumn" msprop:Generator_UserColumnName="Dimension Value Code" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="PCtReal" msprop:nullValue="0" msprop:Generator_ColumnPropNameInRow="PCtReal" msprop:Generator_ColumnVarNameInTable="columnPCtReal" msprop:Generator_ColumnPropNameInTable="PCtRealColumn" msprop:Generator_UserColumnName="PCtReal" type="xs:decimal" minOccurs="0" />
              <xs:element name="Company" msprop:Generator_ColumnVarNameInTable="columnCompany" msprop:Generator_ColumnPropNameInRow="Company" msprop:Generator_ColumnPropNameInTable="CompanyColumn" msprop:Generator_UserColumnName="Company">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Extended_x0020_Description" msprop:Generator_ColumnVarNameInTable="columnExtended_Description" msprop:Generator_ColumnPropNameInRow="Extended_Description" msprop:Generator_ColumnPropNameInTable="Extended_DescriptionColumn" msprop:Generator_UserColumnName="Extended Description" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="No_" msprop:Generator_ColumnVarNameInTable="columnNo_" msprop:Generator_ColumnPropNameInRow="No_" msprop:Generator_ColumnPropNameInTable="No_Column" msprop:Generator_UserColumnName="No_">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Ano" msprop:Generator_ColumnVarNameInTable="columnAno" msprop:Generator_ColumnPropNameInRow="Ano" msprop:Generator_ColumnPropNameInTable="AnoColumn" msprop:Generator_UserColumnName="Ano" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="4" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="PCtSugerido" msprop:Generator_ColumnVarNameInTable="columnPCtSugerido" msprop:Generator_ColumnPropNameInRow="PCtSugerido" msprop:Generator_ColumnPropNameInTable="PCtSugeridoColumn" msprop:Generator_UserColumnName="PCtSugerido" type="xs:decimal" minOccurs="0" />
              <xs:element name="QD-ORC" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="_columnQD_ORC" msprop:Generator_ColumnPropNameInRow="_QD_ORC" msprop:Generator_ColumnPropNameInTable="_QD_ORCColumn" msprop:Generator_UserColumnName="QD-ORC" type="xs:decimal" minOccurs="0" />
              <xs:element name="PVD-ORC" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="_columnPVD_ORC" msprop:Generator_ColumnPropNameInRow="_PVD_ORC" msprop:Generator_ColumnPropNameInTable="_PVD_ORCColumn" msprop:Generator_UserColumnName="PVD-ORC" type="xs:decimal" minOccurs="0" />
              <xs:element name="Min-_PVD-ORC" msdata:ReadOnly="true" msdata:Caption="Min-.PVD-ORC" msprop:Generator_ColumnVarNameInTable="_columnMin__PVD_ORC" msprop:Generator_ColumnPropNameInRow="_Min__PVD_ORC" msprop:Generator_ColumnPropNameInTable="_Min__PVD_ORCColumn" msprop:Generator_UserColumnName="Min-_PVD-ORC" type="xs:decimal" minOccurs="0" />
              <xs:element name="Max-_PVD-ORC" msdata:ReadOnly="true" msdata:Caption="Max-.PVD-ORC" msprop:Generator_ColumnVarNameInTable="_columnMax__PVD_ORC" msprop:Generator_ColumnPropNameInRow="_Max__PVD_ORC" msprop:Generator_ColumnPropNameInTable="_Max__PVD_ORCColumn" msprop:Generator_UserColumnName="Max-_PVD-ORC" type="xs:decimal" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>